--- title: "L1-005 考试座位号" created: 2025-11-28 tags: - 算法 --- # L1-005 考试座位号 ## 题目 [考试座位号](https://pintia.cn/problem-sets/994805046380707840/exam/problems/type/7?problemSetProblemId=994805140211482624&page=0) ![[image-1f2fbf92.png]] ## 思路分析 用map pair ## 代码实现 ```cpp #include using namespace std; #define endl '\n' typedef pair PII; int main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); map local; int total; cin >> total; string n1; int n2, n3; while (total--) { cin >> n1 >> n2 >> n3; local[n2] = {n1, n3}; } int q; cin >> q; while (q--) { int query_key; cin >> query_key; cout << local[query_key].first << " " << local[query_key].second << endl; } return 0; } ``` ## 同类题型 ## 视频讲解 --- ⬅️ [[L1-004 计算摄氏温度|L1-004 计算摄氏温度]] 🏠 [[00-天梯赛]] ➡️ [[L1-006 连续因子|L1-006 连续因子]]